<?php

/**
 * Advertise filter form base class.
 *
 * @package    iEasy
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseAdvertiseFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'name'           => new sfWidgetFormFilterInput(),
      'catalog_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Catalog'), 'add_empty' => true)),
      'image'          => new sfWidgetFormFilterInput(),
      'link'           => new sfWidgetFormFilterInput(),
      'comment'        => new sfWidgetFormFilterInput(),
      'create_time'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'modify_time'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'hit_i'          => new sfWidgetFormFilterInput(),
      'order_i'        => new sfWidgetFormFilterInput(),
      'system_user_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Systemuser'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'name'           => new sfValidatorPass(array('required' => false)),
      'catalog_id'     => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Catalog'), 'column' => 'catalog_id')),
      'image'          => new sfValidatorPass(array('required' => false)),
      'link'           => new sfValidatorPass(array('required' => false)),
      'comment'        => new sfValidatorPass(array('required' => false)),
      'create_time'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'modify_time'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'hit_i'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'order_i'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'system_user_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Systemuser'), 'column' => 'system_user_id')),
    ));

    $this->widgetSchema->setNameFormat('advertise_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Advertise';
  }

  public function getFields()
  {
    return array(
      'advertise_id'   => 'Number',
      'name'           => 'Text',
      'catalog_id'     => 'ForeignKey',
      'image'          => 'Text',
      'link'           => 'Text',
      'comment'        => 'Text',
      'create_time'    => 'Date',
      'modify_time'    => 'Date',
      'hit_i'          => 'Number',
      'order_i'        => 'Number',
      'system_user_id' => 'ForeignKey',
    );
  }
}
